package com.bdqn.service;

import com.bdqn.mapper.LogMapper;
import com.bdqn.pojo.Log;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService{

    @Resource
    LogMapper logMapper;

    /**
     * 日志插入操作
     * @param log
     * @return
     */
    @Override
    public int add(Log log) {
        return logMapper.add(log);
    }

    @Override
    public int add(String content) {
        Log log = new Log();
        log.setContent(content);
        log.setCreateTime(new Date());
        return logMapper.add(log);
    }

    /**
     * 日志信息搜索查询
     * @param queryMap
     * @return
     */
    @Override
    public List<Log> findList(Map<String, Object> queryMap) {
        return logMapper.findList(queryMap);
    }

    /**
     * 模糊搜索总条数
     * @param queryMap
     * @return
     */
    @Override
    public int getTotal(Map<String, Object> queryMap) {
        return logMapper.getTotal(queryMap);
    }

    /**
     *  删除日志信息
     * @param ids
     * @return
     */
    @Override
    public int delete(String ids) {
        return logMapper.delete(ids);
    }
}
